<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Model;

class SmsSendPlan extends Model
{
    protected $table = "sms_send_plan";
    protected $guarded = [];
    public $appends = ['status_name','object_name'];

    public function getStatusNameAttribute()
    {
        switch ($this->status){
            case 0:
                return '未推送';
            case 1:
                return '推送中';
            case 2:
                return '已推送';
        }
    }

    public function getObjectNameAttribute(){
        if ($this->attributes['object']=='all'){
            return '全部用户';
        }elseif ($this->attributes['object']=='order'){
            return '订单未支付用户';
        }elseif ($this->attributes['object']=='coupon'){
            return '优惠券即将到期用户';
        }elseif($this->attributes['object']=='collect'){
            return '指定用户';
        }elseif ($this->attributes['object']=='recharge'){
            return '套餐即将完成用户';
        }
    }
}
